package org.viettan.android.main.io;

import android.graphics.drawable.Drawable;
import android.net.Uri;

public interface NetworkUtility {

    /**
     * Perform an HTTP GET against the specified url and return the response as a string.
     *
     * @param url
     *            full URL to the web page being downloaded
     * @param useCache
     *            retrieve the data from the cache if it is there
     * @return full response of the HTTP GET
     * @throws NetworkException
     *             if a network occurred
     */
    public abstract String httpGet(Uri url, boolean useCache) throws NetworkException;

    /**
     * Downloads the image at the given {@code url} and returns it as a {@code Drawable} so that it
     * can be used directly in views.
     *
     * @param url
     *            full URL to an image on the web
     * @return instance of {@code Drawable} or null if the image cannot be downloaded
     */
    public abstract Drawable getDrawableFromUrl(Uri url);

}